package com.design.pattern.behavior.strategy.pay;

public abstract class Payment {

    //通用逻辑放到抽象类实现
    public MsgResult pay(String uid, double amount) {
        //余额是否充足
        if (queryBalance(uid) < amount) {
            return new MsgResult(1000, "支付失败", "余额不足");
        }
        return new MsgResult(200, "支付成功", "支付金额"+ amount);

    }

    protected abstract String getName();
    protected abstract double queryBalance(String uid);
}
